import { MultiServerMCPClient } from '@langchain/mcp-adapters';

export class McpServer {
  private constructor() {}
  //https://www.npmjs.com/package/@langchain/mcp-adapters
  static getClient() {
    const client = new MultiServerMCPClient({
      throwOnLoadError: true,
      prefixToolNameWithServerName: false,
      additionalToolNamePrefix: '',
      useStandardContentBlocks: true,
      mcpServers: {
        'amap-maps': {
          command: 'npx',
          args: ['-y', '@amap/amap-maps-mcp-server'],
          env: {
            AMAP_MAPS_API_KEY: '1e78c715e27c66645da98320d893cd30',
          },
        },
      },
    });
    return client;
  }

  static async getTools() {
    const tools = await this.getClient().getTools();
    return tools;
  }
}
